Option Strict Off
Option Explicit On
Friend Class especial
	Inherits System.Windows.Forms.Form
	
	'UPGRADE_WARNING: Form event especial.Activate has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
	Private Sub especial_Activated(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Activated
		'Activar
		nombreform = Me.Name
	End Sub
	Private Sub especial_FormClosing(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
		Dim Cancel As Boolean = eventArgs.Cancel
		Dim UnloadMode As System.Windows.Forms.CloseReason = eventArgs.CloseReason
		'el boton cerrar del form
		'Buscamos el form
		For	Each colecForms In My.Application.OpenForms
			If colecForms.Name = informe Then 'Si es el mismo nombre del form
				nombForm = colecForms 'Asignarlo a la variable
			End If
		Next colecForms
		nombForm.Enabled = True
		eventArgs.Cancel = Cancel
	End Sub
	
	Private Sub especial_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Click
		vsb.Focus()
	End Sub
	Private Sub especial_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Dim NewLargeChange As Short
		Dim cont As Integer 'contar
		Dim i, j As Integer 'INDICES
		Dim aux As Integer
		Dim aux2 As Short
		Dim cad As String
		Dim max, cont1, res As Integer
		informe = nombreform
		'Buscamos el form
		For	Each colecForms In My.Application.OpenForms
			If colecForms.Name = informe Then 'Si es el mismo nombre del form
				nombForm = colecForms 'Asignarlo a la variable
			End If
		Next colecForms
		'******* verificar el tipo de ensayo
		'If nombForm.chek_fisi.Value = 1 And nombForm.cmdFisi.Default = True Then cad = "fi" 'And nombForm.txt_fisi = ""
		'If nombForm.Check_micro.Value = 1 And nombForm.cmdMicro.Default = True Then cad = "mi" 'And nombForm.txt_micro = ""
		cad = opcionEspecial
		'** nro. de registros existentes
		'UPGRADE_WARNING: Couldn't resolve default property of object contar_quimicos(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		cont = contar_quimicos(cad)
		band = cont : cadParametros = cad 'El total y tipo de ensayo
		'** dividir en columnas
		If cont > 21 Then
			aux = cont / 2 : aux2 = cont - aux
			If aux > aux2 Then max = aux
			If aux2 > aux Then max = aux2
			If aux = aux2 Then max = aux
		End If
		'*** Mostrar quimicos
		Call especialQuimi("especial", cad, max, 1, cont) 'aux
		'Inicializa los scrolbar (los posiciona y le da los valores max y Largchange )
		Hook(vsb)
		Call EstablecerScrollBar(Me.Name)
		aux = 0 : aux2 = 0
		If cont <= 42 Then 'COLUMNAS
			vsb.Visible = False
		Else
			vsb.Visible = True
			frm_2.Height = VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(chk_especial(max - 1).Top) + 300) 'COLUMNAS
			aux2 = max - 21 'COLUMNAS
			res = 0
			For i = 0 To aux2
				aux = 300 + aux : res = res + 50
			Next i
			If cont > 48 Then res = res + 2000 ''si es mas la cantidad de parametros
			If cont = 48 Then res = 2000 'res aumenta si no se mantiene esto para el max del scroll
		End If
		'===COLUMNAS==========
		If max > 21 Then aux2 = res - aux '2300
		frm_1.Width = VB6.TwipsToPixelsX(5400) '5175
		frm_2.Width = VB6.TwipsToPixelsX(5400)
		vsb.SetBounds(VB6.TwipsToPixelsX(5400), 0, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		vsb.Height = VB6.TwipsToPixelsY(5900)
		'cmdAcept.Move 5620, 120
		'=============
		vsb.Top = 0
		NewLargeChange = 50
		vsb.Maximum = vsb.Maximum + NewLargeChange - vsb.LargeChange
		vsb.LargeChange = NewLargeChange
		vsb.SmallChange = 25
		vsb.Maximum = (aux2 + vsb.LargeChange - 1)
	End Sub
	Private Sub especial_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
		Unhook(vsb)
	End Sub
	
	'UPGRADE_NOTE: vsb.Change was changed from an event to a procedure. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="4E2DC008-5EDA-4547-8317-C9316952674F"'
	'UPGRADE_WARNING: VScrollBar event vsb.Change has a new behavior. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
	Private Sub vsb_Change(ByVal newScrollValue As Integer)
		frm_2.Top = VB6.TwipsToPixelsY(-newScrollValue)
	End Sub
	Private Sub cmdAcept_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdAcept.Click
		Dim aux As Integer
		Dim cad, quimico As String
		Dim i, j As Integer
		
		'Buscamos el form
		For	Each colecForms In My.Application.OpenForms
			If colecForms.Name = informe Then 'Si es el mismo nombre del form
				'nombreform
				nombForm = colecForms 'Asignarlo a la variable
			End If
		Next colecForms
		'**** capturar los checkbox seleccionados
		For i = 0 To band - 1
			If chk_especial(i).CheckState = 1 Then
				'codigoEspecialFisi
				If (j = 0) Then
					cad = chk_especial(i).Text : j = j + 1
					'UPGRADE_WARNING: Couldn't resolve default property of object codQuimico(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					quimico = codQuimico(cad, 0, "")
				Else
					cad = cad & "," & chk_especial(i).Text
					'UPGRADE_WARNING: Couldn't resolve default property of object codQuimico(). Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
					quimico = quimico & "-" + codQuimico(chk_especial(i).Text, 0, "")
				End If
			End If
		Next i
		'**********Enviar los valores
		If cad <> "" Then
			'If informe = "ac" Then
			Select Case cadParametros
				Case Is = "fi"
					'UPGRADE_ISSUE: Control txt_fisi could not be resolved because it was within the generic namespace Form. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="084D22AD-ECB1-400F-B4C7-418ECEC5E36E"'
					nombForm.txt_fisi.Text = cad
					'UPGRADE_ISSUE: Control lbl_quimiFisi could not be resolved because it was within the generic namespace Form. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="084D22AD-ECB1-400F-B4C7-418ECEC5E36E"'
					nombForm.lbl_quimiFisi.Caption = quimico
				Case Is = "mi"
					'UPGRADE_ISSUE: Control txt_micro could not be resolved because it was within the generic namespace Form. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="084D22AD-ECB1-400F-B4C7-418ECEC5E36E"'
					nombForm.txt_micro.Text = cad
					'UPGRADE_ISSUE: Control lbl_quimiMicro could not be resolved because it was within the generic namespace Form. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="084D22AD-ECB1-400F-B4C7-418ECEC5E36E"'
					nombForm.lbl_quimiMicro.Caption = quimico
			End Select
			
			'End If
			Me.Close()
			nombForm.Enabled = True
			
		End If
		
		
	End Sub
	Private Sub vsb_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.ScrollEventArgs) Handles vsb.Scroll
		Select Case eventArgs.type
			Case System.Windows.Forms.ScrollEventType.EndScroll
				vsb_Change(eventArgs.newValue)
		End Select
	End Sub
End Class